package com.github.dengmin.mysql.mapper;

import com.github.dengmin.mysql.model.Role;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @Author dengmin
 * @Created 2020/8/30 上午10:37
 */
public class RoleMapper implements RowMapper<Role> {
    private static final long serialVersionUID = 1L;

    @Override
    public Role mapRow(ResultSet rs, int i) throws SQLException {
        Role role = new Role();
        role.setId(rs.getLong("id"));
        role.setName(rs.getString("role"));
        role.setCode(rs.getString("code"));
        role.setType(rs.getInt("type"));
        role.setGmtCreated(rs.getTimestamp("gmtCreated"));
        role.setGmtModify(rs.getTimestamp("gmtModify"));
        return role;
    }
}
